<?php

/**
 * This is the model class for table "{{adynform}}".
 *
 * The followings are the available columns in table '{{adynform}}':
 * @property integer $ady_id
 * @property string $df_name
 * @property string $df_docName
 * @property integer $org_id
 * @property integer $df_action
 * @property string $adf_xmltag
 *
 * The followings are the available model relations:
 * @property Dynform[] $dynforms
 */
class Adynform extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Adynform the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{adynform}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('org_id, df_action', 'numerical', 'integerOnly'=>true),
			array('df_name', 'length', 'max'=>100),
			array('df_docName', 'length', 'max'=>150),
			array('adf_xmltag', 'length', 'max'=>60),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ady_id, df_name, df_docName, org_id, df_action, adf_xmltag', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'dynforms' => array(self::HAS_MANY, 'Dynform', 'ady_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ady_id' => 'Ady',
			'df_name' => 'Df Name',
			'df_docName' => 'Df Doc Name',
			'org_id' => 'Org',
			'df_action' => 'Df Action',
			'adf_xmltag' => 'Adf Xmltag',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ady_id',$this->ady_id);
		$criteria->compare('df_name',$this->df_name,true);
		$criteria->compare('df_docName',$this->df_docName,true);
		$criteria->compare('org_id',$this->org_id);
		$criteria->compare('df_action',$this->df_action);
		$criteria->compare('adf_xmltag',$this->adf_xmltag,true);

		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
		));
	}
}